package com.tledu.cyrus.utils;

import com.alibaba.fastjson2.JSONObject;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author cyrus
 */
public class ResponseUtils {
    public static void responseJson(HttpServletResponse resp, Object body) throws IOException {
        resp.setCharacterEncoding("utf-8");
        resp.setContentType("application/json;charset=utf-8");
        resp.getWriter().write(JSONObject.toJSONString(body));
    }
}
